#include <machine/asmdefs.h>

ASM_HEADER

FNDEFN_BEGIN(fir_asm)

T00289EE0:
/* load coeff vectors */
	lr		%vr3,%r9,0          ||	lir		%r15,14
        lr              %vr5,%r9,32         ||  ctsr		%r15,5
/* load 1st 16 inputs for lower coeffs */
	lr		%vr0,%r8,0          ||	lir		%r14,1
/* load next 16 inputs in rev order for lower coeffs */
        lrr		%vr1,%r8,32         ||	ctsr		%r14,4
/* load 1st 16 inputs for upper coeffs */
        lru             %vr6,%r8,32         ||  addil           %r10,%r10,-34

/* first iteration */
        rmulreds1r	0,%ac2,%vr0,%vr3
/* next iteration does load of next 16 inputs for upper coeffs */
        rmulreds1r	0,%ac2,%vr0,%vr3    ||  lrr		%vr7,%r8,32
/* loop 14 times */
LOOP0:	rmulreds1r	0,%ac2,%vr0,%vr3    ||  loop		0,%lc1,LOOP0

/* first iteration */
        rmulreds1r	1,%ac0,%vr6,%vr5    ||  ctsr		%r15,5
/* next iteration does load of next 16 inputs for lower coeffs */
        rmulreds1r	1,%ac0,%vr6,%vr5    ||  lrru		%vr1,%r8,32
/* loop 15 times */
LOOP1:	rmulreds1r	1,%ac0,%vr6,%vr5    ||  loop		0,%lc1,LOOP1

/* add outputs from lower and upper calculations */
        radds           %vr4,%vr4,%vr2

START:
/* first iteration does store for previous loop */
        rmulreds1r	0,%ac2,%vr0,%vr3    ||  stru		%vr4,%r10,32     ||  ctsr		%r15,5
/* next iteration does load of next 16 inputs for next loop (upper coeffs) */
        rmulreds1r	0,%ac2,%vr0,%vr3    ||  lrr		%vr7,%r8,32
/* loop 14 times */
LOOP00:	rmulreds1r	0,%ac2,%vr0,%vr3    ||  loop		0,%lc1,LOOP00

/* first iteration */
        rmulreds1r	1,%ac0,%vr6,%vr5    ||  ctsr		%r15,5
/* next iteration does load of next 16 inputs for next loop (lower coeffs) */
        rmulreds1r	1,%ac0,%vr6,%vr5    ||  lrru		%vr1,%r8,32
/* loop 14 times */
LOOP01:	rmulreds1r	1,%ac0,%vr6,%vr5    ||  loop		0,%lc1,LOOP01

/* add outputs from lower and upper calculations */
        radds           %vr4,%vr4,%vr2      ||  loop		0,%lc0,START

T0028B398:
/* final stores of vector AND accumulator */
        stru		%vr4,%r10,32        ||  cfsr            %r13,74
        cfsr            %r14,72
        add             %r13,%r13,%r14
        stuhl           %r13,%r10,32        ||  ji		%jt0,8

FNDEFN_END(fir_asm)
